#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=1010;
int n,K,a[MAXN],ans;
map<int,int>mp;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	n=read();K=read();
	for(int i=1;i<=n;++i)
	{
		a[i]=read();
		int k=sqrt(a[i]);
		for(int j=1;j<=k;++j)
		{
			if(a[i]%j==0)
			{
				++mp[j];
				if(mp[j]>=K&&j>ans)ans=j;
				if(a[i]==j*j)continue;
				++mp[a[i]/j];
				if(mp[a[i]/j]>=K&&a[i]/j>ans)ans=a[i]/j;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}
